﻿using System.Reflection;

namespace Borg
{
    internal class ExtensionTypePlugTask : Task<ExtensionTypeInfo>
    {
        private readonly ExtensionInfo _ei;

        public ExtensionTypePlugTask(ExtensionTypeInfo obj, ExtensionInfo ei,
            uint taskGroupId, Assembly initiator)
            : base(obj, taskGroupId, initiator)
        {
            _ei = ei;
        }

        public override void Execute()
        {
            _ei.InternalPlugInSlots(obj, true, taskGroupId, initiator);
        }

        public override string ToString()
        {
            return string.Format("{0}: {1}.InternalDeregisterPlugs({2})", taskGroupId, obj, _ei);
        }

        public override string Name
        {
            get { return string.Format("Plug({0}, {1})", obj.Name, _ei.Name); }
        }
    }
}

